package ast

type Type int

// AST 节点类别
const (
	Programme Type = iota

	IntDeclaration //整型变量声明
	ExpressionStmt //表达式语句，即表达式后面跟个分号
	AssignmentStmt //赋值语句

	Primary        //基础表达式
	Multiplicative //乘法表达式
	Additive       //加法表达式

	Identifier //标识符
	IntLiteral //整型字面量
)

func (t Type) String() string {
	switch t {
	case Programme:
		return "Programme"
	case IntDeclaration:
		return "IntDeclaration" //整型变量声明
	case ExpressionStmt:
		return "ExpressionStmt" //表达式语句，即表达式后面跟个分号
	case AssignmentStmt:
		return "AssignmentStmt" //赋值语句

	case Primary:
		return "Primary" //基础表达式
	case Multiplicative:
		return "Multiplicative" //乘法表达式
	case Additive:
		return "Additive" //加法表达式

	case Identifier:
		return "Identifier" //标识符
	case IntLiteral:
		return "IntLiteral" //整型字面量
	default:
		return "Unknown"
	}
}
